﻿<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
JHTML::_('behavior.modal', 'a.modal');
$typeArr = array(1 => "Catalogue", 2 => "Cars for sale", 3 => "Upcoming auction");
?>
<form action="index.php" method="post" name="adminForm" >
Model
<input type="text" name="model" id="model" value="<?php echo $this->search['model'];?>" class="text_area"  title="<?php echo JText::_( 'Filter by Model' );?>"/>

&nbsp;&nbsp;
Product type
<select name="type" id="type">
	<option  value="0" >All</option>
	<option  value="1" >Catalogue</option>
    <option  value="2" >Cars for sale</option>
    <option  value="3" >Upcoming auction</option>
</select>

&nbsp;&nbsp;
<button onclick="this.form.submit();"><?php echo JText::_( 'Search' ); ?></button>
<div id="editcell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="2%">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->products ); ?>);" />
			</th>
			<th width="2%" align="center">
				<?php echo JText::_( '#' ); ?>
			</th>
			<th width="20%">
				Model
			</th>
			<th width="10%">
				Type
			</th>
			<th width="5%">
				1st Reg
			</th>
			<th width="15%">
				Short description
			</th>
			<th width="16%">
				Image
			</th>
			<th width="5%">
				Kat No
			</th>
            <th width="10%">
				Desired price
			</th>
			<th width="10%">Order <?php echo JHTML::_('grid.order',  $this->products); ?></th>
            <th width="5%" nowrap="nowrap">Bought</th>
			<th width="5%" nowrap="nowrap">Approve</th>
			<th width="5%" nowrap="nowrap">Publisher</th>
            
		</tr>			
	</thead>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->products); $i < $n; $i++)
	{	$row = &$this->products[$i];
		$checked 	 = JHTML::_('grid.id',   $i, $row->id );
		$link 		 = JRoute::_( 'index.php?option=com_ecommerce&controller=registers&task=edit&cid[]='. $row->id );
		?>
		<tr class="<?php echo "row$k"; ?>">
			<td>
				<?php echo $checked; ?>
			</td>
			<td align="center">
				<?php echo $this->page->getRowOffset( $i ); ?>
			</td>
			<td align="center">
				<a href="<?php echo $link; ?>"><?php echo $row->model; ?></a>
			</td>		
			<td align="center">
				<?php echo $typeArr[$row->type]; ?>
			</td>
			<td align="center">
				<?php echo $row->register_day; ?>
			</td>
			<td align="center">
				<?php echo $row->short_description; ?>
			</td>
			<td align="center">
				<?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$row->image."&w=100&zc=1' title='".$row->model."' alt='".$row->model ."' />";?>
			</td>
			<td align="center">
				<?php echo $row->katno; ?>
			</td>
            <td align="center">
				<?php echo $row->desired_price; ?>,- DKK
			</td>
			<td align="center">
				<?php //$disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
				<input type="text" name="order[]" size="5" value="<?php echo $row->ordering;?>" class="text_area" style="text-align: center" />
			</td>
            
            <?php if($row->bought){ ?>
            <td width="5%" align="center" ><img border="0" alt="Bought" src="images/tick.png"/></td>
            <?php }else{ ?>
            <td width="5%" align="center" ><img border="0" alt="Unbought" src="images/publish_x.png"/></td>
            <?php } ?>
            
            <?php if($row->approve){ ?>
            <td width="5%" align="center" ><a href="#unapprove" onclick="return listItemTask('cb<?php echo $i;?>','unapprove')"><img border="0" alt="Approve" src="images/tick.png"/></a></td>
            <?php }else{ ?>
            <td width="5%" align="center" ><a href="#approve" onclick="return listItemTask('cb<?php echo $i;?>','approve')"><img border="0" alt="Unapprove" src="images/publish_x.png"/></a></td>
            <?php } ?>
				
			<td align="center">
				<a class="modal" rel="{handler: 'iframe', size: {x: 350, y: 250}}" href="../index.php?option=com_ecommerce&view=detail&layout=user&tmpl=component&user_id=<?php echo $row->user_id;?>">View publisher</a>
			</td>
			
           
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
			<tr>
				<td colspan="14">
					<?php echo $this->page->getListFooter(); ?>
				</td>
			</tr>
	</table>
</div>

<input type="hidden" name="option" value="com_ecommerce" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="registers" />
</form>
